<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>下单</title>

    <script type="text/javascript" src="/static/js/jquery-3.4.1.min.js"></script>


    <style type="text/css">
        body {
            background-color:#ffffff;
            text-align:center;
        }

        .lp-login {
            position:absolute;
            width:500px;
            height:300px;
            top:50%;
            left:50%;
            margin-top:-250px;
            margin-left:-250px;
            background: #fff;
            border-radius: 4px;
            box-shadow: 0 0 10px #222928;
            padding: 57px 50px 35px;
            box-sizing: border-box
        }


        .lp-login .submitBtn {
            display:block;
            text-decoration:none;
            height: 48px;
            width: 150px;
            line-height: 48px;
            font-size: 16px;
            color: #453a3a;
            text-align: center;
            background-image: -webkit-gradient(linear, left top, right top, from(#F7FAFB), to(#F3F5F7));
            background-image: linear-gradient(90deg, #F7FAFB, #F3F5F7);
            border-radius: 3px
        }


        input[type='text'] {
            height:30px;
            width:250px;
        }

        span {
            font-style: normal;
            font-variant-ligatures: normal;
            font-variant-caps: normal;
            font-variant-numeric: normal;
            font-variant-east-asian: normal;
            font-weight: normal;
            font-stretch: normal;
            font-size: 14px;
            line-height: 22px;
            font-family: "Hiragino Sans GB", "Microsoft Yahei", SimSun, Arial, "Helvetica Neue", Helvetica;
        }

    </style>
    <script type="text/javascript">
        $(function(){
            $(".submitBtn").bind("click",function(){
                $.ajax({
                    url:'/order/add/1',
                    type:'GET',    //GET
                    async:false,    //或false,是否异步
                    timeout:5000,    //超时时间
                    dataType:'json', //返回的数据格式：json/xml/html/script/jsonp/text
                    success:function(response){
                        if(200 == response.code){
                            let data = response.data;
                             window.location.href = "/payOrder?orderId=" + data.orderId;
                             return false;
                        }else{
                            alert("下单失败~~~,message:" + response.msg);
                        }
                    }
                })
            })
        })

    </script>
</head>
<body>

<form>
    <table class="lp-login">
        <tr align="center">
            <td colspan="2">
                <a href="#" class="submitBtn"><span>下 单</span></a>
            </td>
        </tr>
    </table>
</form>

</body>
</html>
